<template>
<div class="ctlFields-wrapper ui segment">
  <i class="ui icon filter" v-if="!showDetail" @click.prevent.stop="showDetail=!showDetail" title="字段显示控制"></i>

  <enum_many v-if="showDetail&&enumField.enum_val&&enumField.fval!==undefined" :field="enumField" @setVo='setEnum' ></enum_many>
</div>
</template>
<script type="text/ecmascript-6">
import tool from 'src/util/tool';
import util from '_util/index';

import enum_many from 'components/field/enum_many';


export default {
  data() {
    return {
      showFields:null,
      showDetail:false,
      enumField:{
        name:'show_fields',
        title:'显示列',
        enum_val:null
      },
    }
  },
  computed: {
  },
  watch: {
    showFields(val){
      util.store.push(this, 'setShowFields', 'showFields', this.ctl, val, 'list');
    }
  },
  created() {
    if(this.list_fileds){
      this.enumField.enum_val = this.list_fileds;
    }
    this.enumField.fval=this.showFields||JSON.stringify([{code:'id',title:'ID'}])
  },
  methods: {
    setEnum(name, val) {
      this.showFields= val;
    },
  },
  components: {enum_many},
  props: ['list_fileds','ctl']
}
</script>
<style rel="stylesheet/less" scoped lang="less">@dir: "common/";

.fenye-wrapper {
  margin-top:10px;
  /*float: right;*/
    input {
        width: 80px;
    }
}
</style>
